<?php


namespace app\common\lib;


class TokenStr
{
    public static function getLoginToken($string){
        $str = md5(uniqid(md5(microtime("true")),"true"));//生成一个不会重复的字符串
        $token = sha1($str.$string);
        return $token;
    }
    public static function userLoginExpiresTime($type = 2){
        $type = !in_array($type,[1,2])?2:$type;
        if($type == 1 ){
            $day = 7;
        }elseif ($type=2){
            $day = 30;
        }
        return $day*24*3600;
    }
}